package stat;

public class LevelDerivedStat extends DerivedStat {
    
    private int next;
    private int prev;
    
    public LevelDerivedStat( StatType st ) {
        super(st);
        next = 500;
        prev = 0;
        
    }
    
    public LevelDerivedStat( StatType st, int value, Stat... toCache ) {
        super(st, value, toCache);
        next = 500;
        prev = 0;
    }
    
    /**
     * compute the new level value
     */
    public void compute() {
        if(getFromCache(StatType.EXP) >= next) {
            increment();
            prev = next;
            next += (500 * Math.pow(getValue(), 2)); 
        }
        
    }
    
    /**
     * get the exp threshold for next level
     * @return
     */
    public int getNext() {
        return next;
    }
    
    /**
     * get the exp threshold for last level
     * @return
     */
    public int getPrevious() {
        return prev;
    }
}
